//
//  ZMJLrcCell.m
//  Z-QQMusic
//
//  Created by zmj on 15/11/6.
//  Copyright © 2015年 zmj. All rights reserved.
//

#import "ZMJLrcCell.h"
#import "ZMJLrc.h"
#import "Masonry.h"
@implementation ZMJLrcCell
static NSString * const lrcCellID = @"lrcCell";

+ (instancetype)lrcCellWithTableView:(UITableView *)tableView {
    ZMJLrcCell *cell = [tableView dequeueReusableCellWithIdentifier:lrcCellID];
    if (cell == nil) {
        cell = [[ZMJLrcCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:lrcCellID];
        cell.backgroundColor = [UIColor clearColor];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupLrcLabel];
    }
    return self;
}

- (void)setLrc:(ZMJLrc *)lrc {
    _lrc = lrc;
    self.lrcLabel.text = lrc.lrcText;
}

- (void)setupLrcLabel {
    ZMJLrcLabel *lrcLabel = [[ZMJLrcLabel alloc] init];
    lrcLabel.textAlignment = NSTextAlignmentCenter;
    lrcLabel.textColor = [UIColor whiteColor];
    lrcLabel.font = [UIFont systemFontOfSize:14.0];
    [self.contentView addSubview:lrcLabel];
    self.lrcLabel = lrcLabel;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.lrcLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
    }];
}




@end
